# 异常处理的应用
from urllib import request
from urllib import error

# 准备请求对象
url = "http://www.kevintian111111.com/"
req = request.Request(url)

try:
    res = request.urlopen(req)
    html = res.read().decode("UTF-8")
    print(len(html))
except error.URLError as e:
    print(e.reason)
print("ok")
